/// @tags: OldDriverTree ODT
#include <cctype>
#include <cstdio>
#include <set>

namespace BlueQuantum {

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Node {
  int l, r, opt;
  Node(int l, int r, int opt) : l(l), r(r), opt(opt) {}
  inline bool operator<(Node const &rhs) const { return l < rhs.l; }
};

typedef std::set<Node>::iterator iter;
int n, q;
std::set<Node> set;

iter split(int x) {
  iter it = set.upper_bound(Node(x, x, 0));
  if ((--it)->l == x) return it;
  int l = it->l, r = it->r, op = it->opt;
  set.erase(it);
  set.insert(Node(l, x - 1, op));
  return set.insert(Node(x, r, op)).first;
}

int main() {
  int ans;
  ans = read(n), read(q);
  set.insert(Node(1, n, -1));
  for (int l, r, opt; q; --q) {
    read(l), read(r), read(opt);
    opt = opt == 1 ? 0 : -1;
    iter rit = split(r + 1), lit = split(l);
    for (iter i = lit; i != rit; ++i) ans += i->opt * (i->r - i->l + 1);
    set.erase(lit, rit);
    set.insert(Node(l, r, opt));
    if (opt == -1) ans += r - l + 1;
    printf("%d\n", ans);
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("OldDriverTree.in", "r", stdin);
  freopen("OldDriverTree.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}